package com.px.project.module.ht.service.impl;

import java.util.List;

import com.px.common.dto.BaseQueryDto;
import com.px.project.module.ht.entity.StationDao;
import com.px.project.module.ht.mapper.StationMapper;
import com.px.project.module.ht.service.StationService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 站台设置 服务实现类
 *
 * @author 品讯科技
 * @since 2023-10-08
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class StationServiceImpl extends ServiceImpl<StationMapper, StationDao> implements StationService {
    @Override
    public Page<StationDao> page(BaseQueryDto<StationDao> pageVo, StationDao station) {
        LambdaQueryWrapper<StationDao> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.setEntity(station);
        return super.page(pageVo.toPage(), queryWrapper);
    }

    @Override
    public List<StationDao> listOfAll() {
        LambdaQueryWrapper<StationDao> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.orderByAsc(StationDao::getNumber);
        return super.list(queryWrapper);
    }
}